<?php use Backend\Controller\Plugin\AuthorizationPlugin; ?>

<div class="row">
	<div class="col-lg-2">
		<!-- <button type="button" class="form-control btn btn-primary">Ajouter</button> -->
		<a href="creation" class="form-control btn btn-primary" role="button">Ajouter</a>
	</div>
</div>
<br/>
<div ng-app="sejourModule">
	<div class="table-responsive" ng-controller="SejourController">
		<table class="table table-bordered table-hover table-striped tablesorter">
	    	<thead>
	        	<tr>
					<th class="col-sm-1">Code </th>
					<th class="col-sm-2">Image principale </th>
					<th class="col-sm-6">Titre <i class="fa fa-sort"></i></th>
					<th class="col-sm-2">Agence <i class="fa fa-sort"></i></th>
					<th class="col-sm-1">&nbsp;</th>
				</tr>
			</thead>
			<tbody>
				<tr ng-repeat="sejour in sejours">
					<td>{{sejour.code}}</td>
					<td class="imagePrincipale">
						<sejouraccueil th-id="{{sejour.id}}" th-nom="{{sejour.imageUrl}}" th-libelle="{{sejour.titre}}"/>
					</td>
					<td>{{sejour.titre}}</td>
					<td>{{sejour.agenceLibelle}}</td>
					<td>
						<div class="btn-group btn-actions-bo">
							<button type="button" class="btn btn-primary">Actions</button>
						  	<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
						    	<span class="caret"></span>
						    	<span class="sr-only">Toggle Dropdown</span>
						  	</button>
						  	<ul class="dropdown-menu" role="menu">
						  		<?php if( AuthorizationPlugin::isAllowed2($this->layout()->loadIdentity, "Sejour", "edit") ) { ?>
						    		<li><a href="/sejour/edition?id={{sejour.id}}">Editer</a></li>
						    		<li><a href="/sejour/disponibilite?id={{sejour.id}}">Disponibilit&#233;s</a></li>
						    		<li><a href="/sejour/jour-apres-jour?id={{sejour.id}}">Carnet de voyage</a></li>
						    		<li><a href="/sejour/fiche?id={{sejour.id}}">Fiche séjour</a></li>
						    		<li><a href="/sejour/galerie-images?id={{sejour.id}}">Galerie d'images</a></li>
						    	<?php } ?>
						    	
						    	<?php if( AuthorizationPlugin::isAllowed2($this->layout()->loadIdentity, "Sejour", "delete") ) { ?>
						    			<li><a href="#" ng-click="deleteSejour(sejour)">Supprimer</a></li>
						    	<?php } ?>
						  	</ul>
						</div>
					</td>
				</tr>
			</tbody>
		</table>
		<ng-modal ng-model="modal" bouton-valider="supprimerSejour()" />
	</div>
</div>	
